package com.lufei4.chestnut.view;

import com.blankj.utilcode.util.LogUtils;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public class LogInterceptor implements Interceptor {
    private String TAG = "okhttp";

    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request = chain.request();

        LogUtils.aTag(TAG,"request:" + request.toString());
        Response response = chain.proceed(chain.request());
        assert response.body() != null;
        String content  = response.body().toString();
        LogUtils.d(TAG, "response body:" + content);
        return response;
    }
}
